function preview() {
$.ajax({
  type: "POST",
  url: "/posts/preview/",
  data: "data[Post][title]="+encodeURIComponent($("#PostTitle").val())+"&data[Post][content]="+encodeURIComponent($("#PostContent").val()),
  success: function(status){
    $("div.post").html(status);
  }
});
}

$(document).ready(function(){
$("#bpreview").click(
	function () { preview(); }
); // bind
});